<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Index</title>
    <script src="js/jquery-3.1.1.min.js"></script>
</head>
<body>
<a href="testController/goTest">GO</a>
<button onclick="test()">测试</button>
<button onclick="goTest()">测试goTest</button>
<button onclick="testComplex()">测试复杂对象传递</button>
<div id="divShow" style="border: green 1px solid">

</div>
</body>
<script>

    function goTest(){
        $.ajax({
            url:"testController/goTest",
            type:"post",
            success:function (res) {
                console.log(res)
            },
            error:function (msg) {
                console.log(msg)
            }
        })
    }

    function test() {
        $.ajax({
            url:"testController/test",
            type:"post",
            success:function (res) {
                $("#divShow").text($("#divShow").text()+"****"+res);
            },
            error:function (msg) {
                console.log(msg)
            }
        })
    }

    function testComplex(){
        var test={
            a:"a",
            arr:["1","2"],
            // list:[{"a":"0a"},{"b":"b2"}]
            // list:[]
        }
        $.ajax({
            url:"testController/testComplex",
            type:"post",
            data:JSON.stringify(test),
            dataType:"json",
            contentType:"application/json",
            success:function (res) {
                console.log(res)
            },
            error:function (msg) {
                console.log(msg)
            }
        })
    }

</script>
</html>